package com.haidie.gridmember.ui.home.activity

import android.content.Intent
import android.support.v7.widget.GridLayoutManager
import android.view.View
import com.chad.library.adapter.base.BaseQuickAdapter
import com.haidie.gridmember.Constants
import com.haidie.gridmember.R
import com.haidie.gridmember.base.BaseActivity
import com.haidie.gridmember.mvp.bean.SuperviseCountData
import com.haidie.gridmember.ui.home.adapter.PersonnelSupervisionAdapter
import com.haidie.gridmember.ui.home.view.AddResidentInfoDividerItemDecoration
import kotlinx.android.synthetic.main.activity_personnel_supervision.*
import kotlinx.android.synthetic.main.common_toolbar.*

/**
 * Create by   Administrator
 *      on     2018/12/17 09:03
 * description  关爱对象
 */
class CaringObjectActivity : BaseActivity() {
    private val texts = arrayOf(
        "问题青少年", "空巢老人", "疾病患者", "特困群众", "失业人员",
        "残疾人员", "智力障碍人员"
    )
    private var mData = mutableListOf<SuperviseCountData>()
    override fun getLayoutId(): Int = R.layout.activity_personnel_supervision

    override fun initData() {
        mData.clear()
//        mData.add(PersonnelSupervisionData(texts[0], "3", R.color.circle_bg_red))
//        mData.add(PersonnelSupervisionData(texts[1], "5", R.color.circle_bg_grey))
//        mData.add(PersonnelSupervisionData(texts[2], "8", R.color.circle_bg_grey))
//        mData.add(PersonnelSupervisionData(texts[3], "7", R.color.circle_bg_grey))
//        mData.add(PersonnelSupervisionData(texts[4], "6", R.color.circle_bg_grey))
//        mData.add(PersonnelSupervisionData(texts[5], "5", R.color.circle_bg_grey))
//        mData.add(PersonnelSupervisionData(texts[6], "4", R.color.circle_bg_grey))
    }

    override fun initView() {
        ivBack.visibility = View.VISIBLE
        ivBack.setOnClickListener{ onBackPressed() }
        tvTitle.text = "关爱对象"
        val adapter = PersonnelSupervisionAdapter(R.layout.personnel_supervision_item, mData)
        adapter.onItemClickListener = BaseQuickAdapter.OnItemClickListener{
            _,_,position ->
            val intent = Intent(this, DrugAddictActivity::class.java)
            intent.putExtra(Constants.TEXT,adapter.data[position].keyname)
            startActivity(intent)
            overridePendingTransition(R.anim.push_left_in,R.anim.push_left_out)
        }
        recyclerView.let {
            it.setHasFixedSize(true)
            it.layoutManager = GridLayoutManager(this,3)
            it.addItemDecoration(AddResidentInfoDividerItemDecoration(this))
            it.adapter = adapter
        }
    }
    override fun start() {
    }
}